
//
//  ViewController.swift
//  SwiftLibrary
//
//  Created by xicheng on 16/3/12.
//  Copyright © 2016年 taurusxi. All rights reserved.
//

import UIKit

extension UINavigationItem {

  func setLeftBarButtonItem_Margin(_ _leftBarButtonItem: UIBarButtonItem, fixWidth: CGFloat) {

    let negativeSeperator = UIBarButtonItem.init(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
    negativeSeperator.width = fixWidth

    self.setLeftBarButtonItems([negativeSeperator, _leftBarButtonItem], animated: true)
  }
  
  func setRightBarButtonItem_Margin(_ _rightBarButtonItem: UIBarButtonItem, fixWidth: CGFloat) {
    
    let negativeSeperator = UIBarButtonItem.init(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
    negativeSeperator.width = fixWidth
    
    self.setRightBarButtonItems([negativeSeperator, _rightBarButtonItem], animated: true)
  }
}
